package featuremodel.method;

import featuremodel.FeatureRep;
import skyblue.Method;
import skyblue.SkyBlueDef;
import skyblue.Variable;

public class MRequireMethodBind extends Method {
	private Variable a;
	private Variable b;

	public MRequireMethodBind(Variable a, Variable b) {
		this.a = a;
		this.b = b;

		getOutputs().add(a);
		getOutputs().add(b);

	}

	public void setTobeMethodType() {

		a.setTobemethodtype(SkyBlueDef.METHOD_TYPE_BIND);
		b.setTobemethodtype(SkyBlueDef.METHOD_TYPE_BIND);

	}

	public void clearTobeMethodType() {
		a.setTobemethodtype(null);
		b.setTobemethodtype(null);
	}

	public void setTobeMethodType2() {

		a.setTobeMethodType2(SkyBlueDef.METHOD_TYPE_BIND);
		b.setTobeMethodType2(SkyBlueDef.METHOD_TYPE_BIND);
	}

	public void clearTobeMethodType2() {
		a.setTobeMethodType2(null);
		b.setTobeMethodType2(null);
	}

	public void execute() {

		FeatureRep fp = (FeatureRep) a.getValue().getValuerep();
		fp.setBindState(SkyBlueDef.VARIABLE_BIND);
		a.setMethodtype(SkyBlueDef.METHOD_TYPE_BIND);
		a.setTobemethodtype(null);

		fp = (FeatureRep) b.getValue().getValuerep();
		fp.setBindState(SkyBlueDef.VARIABLE_BIND);
		b.setMethodtype(SkyBlueDef.METHOD_TYPE_BIND);
		b.setTobemethodtype(null);

	}

	public Variable getA() {
		return a;
	}

	public void setA(Variable a) {
		this.a = a;
	}

	public Variable getB() {
		return b;
	}

	public void setB(Variable b) {
		this.b = b;
	}

}
